const app = getApp()
import {
  download_type,
  download_list,
} from '../../api/request'

Page({
  data: {
    download_type: [], //素材分类列表
    download_list: [], //素材目录列表
    search_key: '', //搜索关键字
    download_code: '', //已选择分类代码
  },

  search(e) {
    var data = {
      para: [e.detail]
    }
    property_service_by_key(data).then(res => {
      this.setData({
        input_onFocus: true,
        service_list: res.data,
      })
    })
  },

  onLoad: function (options) {
    let that = this
    var data = {
      para: []
    }
    download_type(data).then(res => {
      that.setData({
        download_type: res.data,
      })
    })
  },

  type_select(e) {
    let that = this
    var data = {
      para: [e.currentTarget.dataset.type_code, app.globalData.cur_property_code]
    }
    download_list(data).then(res => {
      that.setData({
        download_list: res.data,
        download_code: e.currentTarget.dataset.type_code,
      })
    })
  },

  onReady: function () {

  },

  onShow: function () {

  },

  onHide: function () {

  },

  onUnload: function () {

  },

  onPullDownRefresh: function () {

  },

  onReachBottom: function () {

  },

  onShareAppMessage: function () {

  },

  //查看详情
  toXq(e) {
    // url: '/pages/xq/index'
    wx.navigateTo({
      url: '/pages/xq/index?broadcast_id=' + e.currentTarget.dataset.broadcast_id+'&property_code='+app.globalData.cur_property_code
    })
  },

})